package com.liveinstars.gateway.business.entity;

/**
 * @author: ting
 * @date: 2019-08-14
 */
public class ChangeSecretKeyDTO {

    private Integer secretKeyVersion;

    private Long appId;

    private String secretPublicKey;

    private Long timestamp;

    private String msg;

    private String magicKey;

    public String getMagicKey() {
        return magicKey;
    }

    public void setMagicKey(String magicKey) {
        this.magicKey = magicKey;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Integer getSecretKeyVersion() {
        return secretKeyVersion;
    }

    public void setSecretKeyVersion(Integer secretKeyVersion) {
        this.secretKeyVersion = secretKeyVersion;
    }

    public Long getAppId() {
        return appId;
    }

    public void setAppId(Long appId) {
        this.appId = appId;
    }

    public String getSecretPublicKey() {
        return secretPublicKey;
    }

    public void setSecretPublicKey(String secretPublicKey) {
        this.secretPublicKey = secretPublicKey;
    }

    public Long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(Long timestamp) {
        this.timestamp = timestamp;
    }

    public boolean check(AuthSecretDTO dto) {
        if (this.secretPublicKey.equals(dto.getSecretKeyDTO().getPublicSecretKey())) {
            return true;
        } else {
            return false;
        }
    }
    public void copyFromAuthSecretDTO(AuthSecretDTO dto) {
        this.appId = dto.getAppId();
        this.secretKeyVersion = dto.getVersion();
        this.secretPublicKey = dto.getSecretKeyDTO().getPublicSecretKey();
        this.timestamp = System.currentTimeMillis() / 1000;
    }

}
